package com.gy.universities.service.impl;
import com.gy.universities.dao.StudyCoursetypeMapper;
import com.gy.universities.entity.StudyCoursetype;
import com.gy.universities.service.StudyCoursetypeService;
//import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service
public class StudyCoursetypeServiceImpl implements StudyCoursetypeService {

    @Resource
    private StudyCoursetypeMapper studyCoursetypeMapper;

    public StudyCoursetype getStudyCoursetypeById(String id)throws Exception{
        return studyCoursetypeMapper.getStudyCoursetypeById(id);
    }

    public List<StudyCoursetype>	getStudyCoursetypeListByMap(Map<String,Object> param)throws Exception{
        return studyCoursetypeMapper.getStudyCoursetypeListByMap(param);
    }

    public Integer getStudyCoursetypeCountByMap(Map<String,Object> param)throws Exception{
        return studyCoursetypeMapper.getStudyCoursetypeCountByMap(param);
    }

    public Integer qdtxAddStudyCoursetype(StudyCoursetype studyCoursetype)throws Exception{
            //studyCoursetype.setCreatedTime(new Date());
            return studyCoursetypeMapper.insertStudyCoursetype(studyCoursetype);
    }

    public Integer qdtxModifyStudyCoursetype(StudyCoursetype studyCoursetype)throws Exception{
        //studyCoursetype.setUpdatedTime(new Date());
        return studyCoursetypeMapper.updateStudyCoursetype(studyCoursetype);
    }

    public Integer qdtxDeleteStudyCoursetypeById(String id)throws Exception{
        return studyCoursetypeMapper.deleteStudyCoursetypeById(id);
    }

    public Integer qdtxBatchDeleteStudyCoursetype(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studyCoursetypeMapper.batchDeleteStudyCoursetype(param);
    }


}
